const { Schema, model } = require('mongoose');

const moment = require('moment');

//设置数据集合s
const CarCommentSchema = new Schema({
    userID:{//关联用户        
        type: Schema.Types.ObjectId,
        ref: 'User'
    },
    orderID:{//关联订单
        type: Schema.Types.ObjectId,
        ref: 'Order'
    },
    carID:{//关联车辆
        type: Schema.Types.ObjectId,
        ref: 'Car'
    },
    content:String,//车辆详情
    score:Number,//评分s
    createDate:{
        type: String,
        default: moment().format('YYYY年MM月DD日')
    }, //评价时间
}, { versionKey: false });

//设置数据集合的模型
const CarComments = model('CarComments', CarCommentSchema, 'carComments');

//暴露
module.exports.CarComments = CarComments;